const webpack = require('webpack')
const { merge } = require('webpack-merge')
const common = require('./webpack.common')
const path = require('path')

module.exports = () => {
  const config = merge(common, {
    mode: 'development',
    devServer: {
      contentBase: path.join(__dirname, "dist"),
      // contentBase: [path.join(__dirname, "public")],
      hot: true,
      // hotOnly: true,
      inline: true,
      open: true
    },
    // source-map 模式
    devtool: 'cheap-module-eval-source-map',
    plugins: [
      // 开启热更新
      new webpack.HotModuleReplacementPlugin()
    ]
  })
  return config
}
